from PySide6 import QtCore, QtGui, QtWidgets

import requests

# 来源：在线英语语法分析
#   https://aipie.cool/ega/

# input
# Android’s SurfaceFlinger is a system service provided on the Android Operating System.

# image
# curl 'https://api.aipie.cool/api/ega/analysis/img?text=Android%E2%80%99s%20SurfaceFlinger%20is%20a%20system%20service%20provided%20on%20the%20Android%20Operating%20System.' \
#   -H 'accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8' \
#   -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' \
#   -H 'cookie: Hm_lvt_a205d03b7ddf183fde5cd2c6dab3a878=1737095678; HMACCOUNT=3AE5DB0776791279; Hm_lpvt_a205d03b7ddf183fde5cd2c6dab3a878=1737095826' \
#   -H 'priority: u=1, i' \
#   -H 'referer: https://aipie.cool/' \
#   -H 'sec-ch-ua: "Microsoft Edge";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
#   -H 'sec-ch-ua-mobile: ?0' \
#   -H 'sec-ch-ua-platform: "Linux"' \
#   -H 'sec-fetch-dest: image' \
#   -H 'sec-fetch-mode: no-cors' \
#   -H 'sec-fetch-site: same-site' \
#   -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0'

# tokens
# curl 'https://api.aipie.cool/api/ega/analysis/tokens' \
#   -H 'accept: */*' \
#   -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' \
#   -H 'content-type: application/json' \
#   -H 'origin: https://aipie.cool' \
#   -H 'priority: u=1, i' \
#   -H 'referer: https://aipie.cool/' \
#   -H 'sec-ch-ua: "Microsoft Edge";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
#   -H 'sec-ch-ua-mobile: ?0' \
#   -H 'sec-ch-ua-platform: "Linux"' \
#   -H 'sec-fetch-dest: empty' \
#   -H 'sec-fetch-mode: cors' \
#   -H 'sec-fetch-site: same-site' \
#   -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0' \
#   --data-raw '{"text":"Android’s SurfaceFlinger is a system service provided on the Android Operating System."}'

# {"code": 1, "data": ["Android", "'s", "SurfaceFlinger", "is", "a", "system", "service", "provided", "on", "the", "Android", "Operating", "System", "."]}


# translate
# curl 'https://api.aipie.cool/api/translate' \
#   -H 'accept: */*' \
#   -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' \
#   -H 'content-type: application/json' \
#   -H 'origin: https://aipie.cool' \
#   -H 'priority: u=1, i' \
#   -H 'referer: https://aipie.cool/' \
#   -H 'sec-ch-ua: "Microsoft Edge";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
#   -H 'sec-ch-ua-mobile: ?0' \
#   -H 'sec-ch-ua-platform: "Linux"' \
#   -H 'sec-fetch-dest: empty' \
#   -H 'sec-fetch-mode: cors' \
#   -H 'sec-fetch-site: same-site' \
#   -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0' \
#   --data-raw '{"text":"Android’s SurfaceFlinger is a system service provided on the Android Operating System.","fmt":"simple"}'

# {"code": 1, "data": "Androids surflinger\u662fAndroid\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u63d0\u4f9b\u7684\u4e00\u79cd\u7cfb\u7edf\u670d\u52a1."}


# token translate
# curl 'https://api.aipie.cool/api/translate' \
#   -H 'accept: */*' \
#   -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' \
#   -H 'content-type: application/json' \
#   -H 'origin: https://aipie.cool' \
#   -H 'priority: u=1, i' \
#   -H 'referer: https://aipie.cool/' \
#   -H 'sec-ch-ua: "Microsoft Edge";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
#   -H 'sec-ch-ua-mobile: ?0' \
#   -H 'sec-ch-ua-platform: "Linux"' \
#   -H 'sec-fetch-dest: empty' \
#   -H 'sec-fetch-mode: cors' \
#   -H 'sec-fetch-site: same-site' \
#   -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0' \
#   --data-raw '{"text":"provided","fmt":"normal"}'

# provided
# {"code": 1, "data": {"word": "provided", "lang": "en", "translation": [{"data": "[pr\u04d9'vaidid]", "type": "phonetic", "color": "blue", "size": "0"}, {"data": "conj. \u5018\u82e5, \u4ee5...\u4e3a\u6761\u4ef6", "type": "translation", "color": "", "size": "0"}, {"data": "\u67ef\u6797\u65af\u661f\u7ea7:2", "type": "information", "color": "#BEBEBE", "size": "-2"}, {"data": "CET4 CET6 \u8003\u7814 \u96c5\u601d", "type": "information", "color": "#BEBEBE", "size": "-2"}], "relative": {"\u539f\u578b": "provide"}, "engine": "en_zh_dict", "metadata": "", "license": {"title": "", "link": ""}}}

# s
# {"code": 1, "data": {"word": "'s", "lang": "en", "translation": [{"data": "\u662f\u56e0\u4e3a", "type": "translation", "color": "", "size": "0"}], "relative": {}, "engine": "argos", "metadata": "", "license": {"title": "", "link": ""}}}
